package com.lookme.lmtool.cracker.filter.blur;

import com.jhlabs.image.BoxBlurFilter;
import com.lookme.lmtool.cracker.CrackerConstants;
import com.lookme.lmtool.cracker.annotation.FilterAnnotation;
import com.lookme.lmtool.cracker.annotation.ParamAnnotation;
import com.lookme.lmtool.cracker.filter.AbstractFilter;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

import java.awt.image.BufferedImageOp;

@FilterAnnotation(groupName = CrackerConstants.FILTER_GROUP_NAME_BLUR,name="盒状模糊")
public class FilterBoxBlur extends AbstractFilter {
    @XStreamAsAttribute
    @ParamAnnotation(name = "水平半径", desc = "水平半径",inputType = ParamAnnotation.InputType.Slider,width = 300,amountToStepBy = 0.05,max=100,blockIncrement = 5,majorTickUnit=10)
    private float hRadius=1f;
    @XStreamAsAttribute
    @ParamAnnotation(name = "垂直半径", desc = "垂直半径",inputType = ParamAnnotation.InputType.Slider,width = 300,amountToStepBy = 0.05,max=100,blockIncrement = 5,majorTickUnit=10)
    private float vRadius=0f;
    @XStreamAsAttribute
    @ParamAnnotation(name = "次数", desc = "次数",inputType = ParamAnnotation.InputType.Spinner)
    private int iterations=1;

    @Override
    public BufferedImageOp getFilter() {
        return new BoxBlurFilter(hRadius,vRadius,iterations);
    }
}
